var t = require("../../../@babel/runtime/helpers/interopRequireDefault").default,
  a = require("../../../utils/http"),
  e = t(require("../../../utils/util")),
  n = new a.HTTP;
Page({
  data: {
    taga: [{
      id: 1,
      name: "1月"
    }, {
      id: 2,
      name: "2月"
    }, {
      id: 3,
      name: "3月"
    }, {
      id: 4,
      name: "4月"
    }, {
      id: 5,
      name: "5月"
    }, {
      id: 6,
      name: "6月"
    }, {
      id: 7,
      name: "7月"
    }, {
      id: 8,
      name: "8月"
    }, {
      id: 9,
      name: "9月"
    }, {
      id: 10,
      name: "10月"
    }, {
      id: 11,
      name: "11月"
    }, {
      id: 12,
      name: "12月"
    }],
    course: [{
      id: 1,
      name: "去化统计"
    }, {
      id: 2,
      name: "新增税收"
    }, {
      id: 3,
      name: "新增税源"
    }],
    currentItem: e.default.formatDates(new Date),
    courseItem: 1,
    year: e.default.formatYear(new Date),
    list: 1
  },
  onLoad: function () {
    var t = this;
    n.request({
      url: "https://www.qlsyyun.com:3000/tank/process",
      data: {
        arr: 3,
        yf: t.data.currentItem
      }
    }).then((function (a) {
      if (console.log(a.data, "data"), 0 == a.data.length)
        t.setData({
          alone: [],
          sum: 0
        });
      else {
        for (var e = a.data.map((function (t) {
            return t.rza
          })), n = 0, r = 0; r < e.length; r++)
          n += e[r];
        t.setData({
          alone: a.data,
          sum: n.toFixed(2)
        })
      }
    }))
  },
  tagChoose: function (t) {
    var a = this,
      r = t.currentTarget.dataset.id;
    a.setData({
        currentItem: r
      }),
      1 == a.data.list ? n.request({
        url: "https://www.qlsyyun.com:3000/tank/process",
        data: {
          yf: r,
          arr: 3
        }
      }).then((function (t) {
        if (0 == t.data.length)
          a.setData({
            alone: [],
            sum: 0,
            list: 1
          });
        else {
          for (var e = t.data.map((function (t) {
              return t.rza
            })), n = 0, r = 0; r < e.length; r++)
            n += e[r];
          a.setData({
            alone: t.data,
            sum: n.toFixed(2),
            list: 1
          })
        }
      })) : 2 == a.data.list ? n.request({
        url: "https://www.qlsyyun.com:3000/tank/process",
        data: {
          arr: 4,
          yf: a.data.currentItem
        }
      }).then((function (t) {
        if (r > e.default.formatDates(new Date) - 2)
          a.setData({
            alone: [],
            sum: 0,
            list: 2
          });
        else {
          for (var n = t.data.map((function (t) {
              return t.num
            })), s = 0, u = 0; u < n.length; u++)
            s += n[u];
          a.setData({
            alone: t.data,
            sum: s.toFixed(5),
            list: 2
          })
        }
      })) : n.request({
        url: "https://www.qlsyyun.com:3000/tank/process",
        data: {
          arr: 5,
          yf: r
        }
      }).then((function (t) {
        if (0 == t.data.length)
          a.setData({
            alone: [],
            sum: 0,
            list: 3
          });
        else {
          for (var e = t.data, n = e.map((function (t) {
              return t.bja
            })), r = 0, s = 0, u = 0; u < n.length; u++)
            r += n[u];
          for (var l = e.map((function (t) {
              return t.bjag
            })), i = 0; i < l.length; i++)
            s += l[i];
          a.setData({
            alone: t.data,
            sum: r,
            suma: s,
            list: 3
          })
        }
      }))
  },
  tagClick: function (t) {
    var a = this,
      r = t.currentTarget.dataset.id;
    a.setData({
        courseItem: r
      }),
      1 == r ? (a.setData({
        currentItem: e.default.formatDates(new Date)
      }), n.request({
        url: "https://www.qlsyyun.com:3000/tank/process",
        data: {
          arr: 3,
          yf: a.data.currentItem
        }
      }).then((function (t) {
        if (0 == t.data.length)
          a.setData({
            alone: [],
            sum: 0,
            list: 1
          });
        else {
          for (var e = t.data.map((function (t) {
              return t.rza
            })), n = 0, r = 0; r < e.length; r++)
            n += e[r];
          a.setData({
            alone: t.data,
            sum: n.toFixed(2),
            list: 1
          })
        }
      }))) : 2 == r ? (a.setData({
        currentItem: a.data.currentItem - 2
      }), n.request({
        url: "https://www.qlsyyun.com:3000/tank/process",
        data: {
          arr: 4,
          yf: a.data.currentItem
        }
      }).then((function (t) {
        if (0 == t.data.length)
          a.setData({
            alone: [],
            sum: 0,
            list: 2
          });
        else {
          for (var e = t.data.map((function (t) {
              return t.num
            })), n = 0, r = 0; r < e.length; r++)
            n += e[r];
          a.setData({
            alone: t.data,
            sum: n.toFixed(5),
            list: 2
          })
        }
      }))) : (a.setData({
        currentItem: e.default.formatDates(new Date)
      }), n.request({
        url: "https://www.qlsyyun.com:3000/tank/process",
        data: {
          arr: 5,
          yf: a.data.currentItem
        }
      }).then((function (t) {
        if (0 == t.data.length)
          a.setData({
            alone: [],
            sum: 0,
            suma: 0,
            list: 3
          });
        else {
          for (var e = t.data, n = e.map((function (t) {
              return t.bja
            })), r = 0, s = 0, u = 0; u < n.length; u++)
            r += n[u];
          for (var l = e.map((function (t) {
              return t.bjag
            })), i = 0; i < l.length; i++)
            s += l[i];
          a.setData({
            alone: t.data,
            sum: r,
            suma: s,
            list: 3
          })
        }
      })))
  }
});